package main

import (
	"github.com/labstack/gommon/log"
	"net/http"

	"github.com/labstack/echo/v4"
)

func main() {
	e := echo.New()
	e.Static("/static", "static")
	//Echo#Logger.SetLevel(log.Lvl) 用于设置日志级别，默认是 ERROR
	e.Logger.SetLevel(log.INFO)
	//Echo#Logger.SetHeader(string) 用于设置日志格式
	e.Logger.SetHeader(`{"time":"${time_rfc3339_nano}","level":"${level}","prefix":"${prefix}","file":"${short_file}:${line}","message":"${message}"}`)

	e.GET("/", func(c echo.Context) error {
		return c.String(http.StatusOK, "Hello, World!")
	})
	e.Logger.Fatal(e.Start(":80"))
}
